package com.rpay.dao.basic;

import com.rpay.model.basic.BasicDO;
import org.mybatis.spring.SqlSessionTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public class BasicDao {
    @Autowired
    @Qualifier("readSqlSession")
    private SqlSessionTemplate readSqlSession;

    @Autowired
    @Qualifier("writeSqlSession")
    private SqlSessionTemplate writeSqlSession;

    public List<BasicDO> selectDataList() {
        return readSqlSession.selectList("rpay.basic.selectDataList", null);
    }

    public BasicDO findByCode(String code){
        return readSqlSession.selectOne("rpay.basic.findByCode", code);
    }

    public int updateByCode(BasicDO basicDO) {
        return writeSqlSession.update("rpay.basic.updateByCode", basicDO);
    }
}
